﻿<%@ Control Language="VB" AutoEventWireup="false" CodeFile="CustomerInfo.ascx.vb" Inherits="CustomerInfo" %>

<asp:UpdatePanel ID="upnlCustomerInfo" runat="server">
<ContentTemplate>
    <div class="CustomerInfo">
    <asp:Label ID="lblUserID" runat="server" Visible="false" />
    <asp:Label ID="lblCustomerID" runat="server" Visible="false" />
    <asp:AccessDataSource ID="UserData" runat="server" 
        DataFile="~/App_Data/GotPink.accdb"  
        InsertCommand="INSERT INTO [Users] ([UserName], [Password], [SecurityQuestion1], [SecurityQuestion2], [SecurityAnswer1], [SecurityAnswer2]) VALUES (?, ?, ?, ?, ?, ?)" 
        SelectCommand="SELECT [UserID], [UserName], [Password], [SecurityQuestion1], [SecurityQuestion2], [SecurityAnswer1], [SecurityAnswer2] FROM [Users] WHERE [UserID] = ?" 
        UpdateCommand="UPDATE [Users] SET [UserName] = ?, [Password] = ?, [SecurityQuestion1] = ?, [SecurityQuestion2] = ?, [SecurityAnswer1] = ?, [SecurityAnswer2] = ? WHERE [UserID] = ?">
        <InsertParameters>
            <asp:Parameter Name="UserName" Type="String" />
            <asp:Parameter Name="Password" Type="String" />
            <asp:Parameter Name="SecurityQuestion1" Type="String" />
            <asp:Parameter Name="SecurityQuestion2" Type="String" />
            <asp:Parameter Name="SecurityAnswer1" Type="String" />
            <asp:Parameter Name="SecurityAnswer2" Type="String" />    
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="UserName" Type="String" />
            <asp:Parameter Name="Password" Type="String" />
            <asp:Parameter Name="SecurityQuestion1" Type="String" />
            <asp:Parameter Name="SecurityQuestion2" Type="String" />
            <asp:Parameter Name="SecurityAnswer1" Type="String" />
            <asp:Parameter Name="SecurityAnswer2" Type="String" />
            <asp:Parameter Name="UserID" Type="Int32" />
        </UpdateParameters>
        <SelectParameters>
            <asp:ControlParameter ControlID="lblUserID" ConvertEmptyStringToNull="true" DbType="Int32" PropertyName="Text" /> 
        </SelectParameters>
    </asp:AccessDataSource>
    <asp:AccessDataSource ID="CustomerData" runat="server" 
        DataFile="~/App_Data/GotPink.accdb" 
        InsertCommand="INSERT INTO [Customers] ([FirstName], [LastName], [Address1], [Address2], [City], [StateProvince], [PostalCode], [Country], [PhoneNumber], [EmailAddress], [UserID]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" 
        SelectCommand="SELECT [FirstName], [LastName], [Address1], [Address2], [City], [StateProvince], [PostalCode], [Country], [PhoneNumber], [EmailAddress], [CustomerID], [UserID] FROM [Customers] Where [CustomerID] = ?" 
        UpdateCommand="UPDATE [Customers] SET [FirstName] = ?, [LastName] = ?, [Address1] = ?, [Address2] = ?, [City] = ?, [StateProvince] = ?, [PostalCode] = ?, [Country] = ?, [PhoneNumber] = ?, [EmailAddress] = ? WHERE [CustomerID] = ?">
        <InsertParameters>
            <asp:Parameter Name="FirstName" Type="String" />
            <asp:Parameter Name="LastName" Type="String" />
            <asp:Parameter Name="Address1" Type="String" />
            <asp:Parameter Name="Address2" Type="String" />
            <asp:Parameter Name="City" Type="String" />
            <asp:Parameter Name="StateProvince" Type="String" />
            <asp:Parameter Name="PostalCode" Type="String" />
            <asp:Parameter Name="Country" Type="String" />
            <asp:Parameter Name="PhoneNumber" Type="String" />
            <asp:Parameter Name="EmailAddress" Type="String" />
            <asp:Parameter Name="UserID" Type="Int32" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="FirstName" Type="String" />
            <asp:Parameter Name="LastName" Type="String" />
            <asp:Parameter Name="Address1" Type="String" />
            <asp:Parameter Name="Address2" Type="String" />
            <asp:Parameter Name="City" Type="String" />
            <asp:Parameter Name="StateProvince" Type="String" />
            <asp:Parameter Name="PostalCode" Type="String" />
            <asp:Parameter Name="Country" Type="String" />
            <asp:Parameter Name="PhoneNumber" Type="String" />
            <asp:Parameter Name="EmailAddress" Type="String" />
            <asp:Parameter Name="CustomerID" Type="Int32" />
        </UpdateParameters>
        <SelectParameters>
            <asp:ControlParameter ControlID="lblCustomerID" ConvertEmptyStringToNull="true" DbType="Int32" PropertyName="Text" /> 
        </SelectParameters>
    </asp:AccessDataSource>
    <br />
    <div id="errors">
        <asp:Label ID="lblError" runat="server" Text=""/>
        <asp:ValidationSummary ValidationGroup="CustomerInfo" CssClass="errorSection" DisplayMode="List" ID="vldSummary" runat="server" />
    </div>
    <div id="custdetails">
        <asp:DetailsView ID="dvCustomerData" GridLines="Vertical" runat="server" AutoGenerateRows="False" 
            DataKeyNames="CustomerID" DataSourceID="CustomerData" Width="500px" FieldHeaderStyle-CssClass="tdright" RowStyle-CssClass="tdleft">
        <FieldHeaderStyle CssClass="tdright"></FieldHeaderStyle>
            <Fields>
                <asp:TemplateField HeaderText="First Name" SortExpression="FirstName">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtFirstName" MaxLength="50" runat="server" Text='<%# Bind("FirstName") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtFirstName" ID="vldReqFirstName" runat="server" Display="Dynamic" ErrorMessage="First Name required" Text="*"/>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="txtFirstName" MaxLength="50" runat="server" Text='<%# Bind("FirstName") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtFirstName" ID="vldReqFirstName" runat="server" Display="Dynamic" ErrorMessage="First Name required" Text="*"/>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("FirstName") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Last Name" SortExpression="LastName">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtLastName" MaxLength="50" runat="server" Text='<%# Bind("LastName") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtLastName" ID="vldReqLastName" runat="server" Display="Dynamic" ErrorMessage="Last Name required" Text="*"/>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="txtLastName" MaxLength="50" runat="server" Text='<%# Bind("LastName") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtLastName" ID="vldReqLastName" runat="server" Display="Dynamic" ErrorMessage="Last Name required" Text="*"/>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("LastName") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Address1" SortExpression="Address1">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtAddress1" MaxLength="100" runat="server" Text='<%# Bind("Address1") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtAddress1" ID="vldReqAddress1" runat="server" Display="Dynamic" ErrorMessage="Address1 required" Text="*"/>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="txtAddress1" MaxLength="100" runat="server" Text='<%# Bind("Address1") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtAddress1" ID="vldReqAddress1" runat="server" Display="Dynamic" ErrorMessage="Address1 required" Text="*"/>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("Address1") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Address2" SortExpression="Address2">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtAddress2" MaxLength="100" runat="server" Text='<%# Bind("Address2") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="txtAddress2" MaxLength="100" runat="server" Text='<%# Bind("Address2") %>'></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("Address2") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="City" SortExpression="City">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtCity" runat="server" Text='<%# Bind("City") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtCity" ID="vldReqCity" runat="server" Display="Dynamic" ErrorMessage="City required" Text="*"/>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="txtCity" runat="server" Text='<%# Bind("City") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtCity" ID="vldReqCity" runat="server" Display="Dynamic" ErrorMessage="City required" Text="*"/>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label5" runat="server" Text='<%# Bind("City") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="State/Province" SortExpression="StateProvince">
                    <EditItemTemplate>
                        <asp:DropDownList Width="150px" ID="ddlStates" runat="server" DataSourceID="StateData" 
                            DataTextField="Name" DataValueField="Abbreviation" 
                            SelectedValue='<%# Bind("StateProvince") %>' />
                            <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="ddlStates" Display="Dynamic" ID="vldReqState" runat="server" ErrorMessage="Select a State" Text="*"/>                        
                            <asp:AccessDataSource ID="StateData" runat="server" 
                                DataFile="~/App_Data/GotPink.accdb" 
                                SelectCommand="SELECT '[Select State]' as [Name], '' as [Abbreviation] FROM [StateProvinces] UNION SELECT [Name], [Abbreviation] FROM [StateProvinces]" />
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:DropDownList AutoPostBack="true" OnSelectedIndexChanged="StateChanged" Width="150px" ID="ddlStates" runat="server" DataSourceID="StateData" 
                            DataTextField="Name" DataValueField="Abbreviation" SelectedValue='<%# Bind("StateProvince") %>' />
                            <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="ddlStates" Display="Dynamic" ID="vldReqState" runat="server" ErrorMessage="Select a State" Text="*"/>                        
                            <asp:AccessDataSource ID="StateData" runat="server" 
                                DataFile="~/App_Data/GotPink.accdb" 
                                SelectCommand="SELECT '[Select State]' as [Name], '' as [Abbreviation] FROM [StateProvinces] UNION SELECT [Name], [Abbreviation] FROM [StateProvinces]" />
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label6" runat="server" Text='<%# Bind("StateProvince") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Postal Code" SortExpression="PostalCode">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtPostalCode" runat="server" Text='<%# Bind("PostalCode") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtPostalCode" ID="vldReqPostalCode" runat="server" Display="Dynamic" ErrorMessage="Postal Code required" Text="*"/>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="txtPostalCode" runat="server" Text='<%# Bind("PostalCode") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtPostalCode" ID="vldReqPostalCode" runat="server" Display="Dynamic" ErrorMessage="Postal Code required" Text="*"/>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label7" runat="server" Text='<%# Bind("PostalCode") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Country" SortExpression="Country">
                    <EditItemTemplate>
                        <asp:Label ID="lblCountry" runat="server" Text='<%# Bind("Country") %>'></asp:Label>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:Label ID="lblCountry" runat="server" Text='<%# Bind("Country") %>'></asp:Label>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="lblCountry" runat="server" Text='<%# Bind("Country") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Phone Number" SortExpression="PhoneNumber">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtPhone" runat="server" Text='<%# Bind("PhoneNumber") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtPhone" ID="vldReqPhone" runat="server" Display="Dynamic" ErrorMessage="Phone required" Text="*"/>    
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="txtPhone" runat="server" Text='<%# Bind("PhoneNumber") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtPhone" ID="vldReqPhone" runat="server" Display="Dynamic" ErrorMessage="Phone required" Text="*"/>    
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label9" runat="server" Text='<%# Bind("PhoneNumber") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="E-mail" SortExpression="EmailAddress">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtEmail" runat="server" Text='<%# Bind("EmailAddress") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtEmail" ID="vldReqEmail" runat="server" Display="Dynamic" ErrorMessage="E-mail required" Text="*"/>    
                        <asp:RegularExpressionValidator ID="vldRegExEmail" runat="server" Display="Dynamic" Text="*" 
                            ValidationGroup="CustomerInfo" ControlToValidate="txtEmail" ErrorMessage="Enter a valid E-mail" 
                            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" />
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="txtEmail" runat="server" Text='<%# Bind("EmailAddress") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtEmail" ID="vldReqEmail" runat="server" Display="Dynamic" ErrorMessage="E-mail required" Text="*"/>    
                        <asp:RegularExpressionValidator ID="vldRegExEmail" runat="server" Display="Dynamic" Text="*"
                            ValidationGroup="CustomerInfo" ControlToValidate="txtEmail" ErrorMessage="Enter a valid E-mail" 
                            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" />
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label10" runat="server" Text='<%# Bind("EmailAddress") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField Visible="false" HeaderText="UserID" SortExpression="UserID">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtUserID" runat="server" Text='<%# Bind("UserID") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="txtUserID" runat="server" Text='<%# Bind("UserID") %>'></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label11" runat="server" Text='<%# Bind("UserID") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
            </Fields>

        <RowStyle CssClass="tdleft"></RowStyle>
        </asp:DetailsView>
        <br />
        <asp:DetailsView GridLines="Vertical" ID="dvUserData" runat="server" AutoGenerateRows="False" 
            DataKeyNames="UserID" DataSourceID="UserData" Width="500px" FieldHeaderStyle-CssClass="tdright" RowStyle-CssClass="tdleft">
        <FieldHeaderStyle CssClass="tdright"></FieldHeaderStyle>
            <Fields>
                <asp:TemplateField HeaderText="UserName" SortExpression="UserName">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtUserName" MaxLength="50" runat="server" Text='<%# Bind("UserName") %>'/>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtUserName" ID="vldReqUserName" runat="server" Display="Dynamic" ErrorMessage="UserName is required" Text="*"/>
                        <asp:CustomValidator ID="vldCustUserName" ValidationGroup="CustomerInfo" ControlToValidate="txtUserName" 
                            runat="server" Display="Dynamic" ErrorMessage="UserName is already taken" 
                            Text="*" onservervalidate="vldCustUserName_ServerValidate" />
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="txtUserName" MaxLength="50" runat="server" Text='<%# Bind("UserName") %>'/>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtUserName" ID="vldReqUserName" runat="server" Display="Dynamic" ErrorMessage="UserName is required" Text="*"/>
                        <asp:CustomValidator ID="vldCustUserName" ValidationGroup="CustomerInfo" ControlToValidate="txtUserName" 
                            runat="server" Display="Dynamic" ErrorMessage="UserName is already taken" 
                            Text="*" onservervalidate="vldCustUserName_ServerValidate" />
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("UserName") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Password" SortExpression="Password">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtPassword" MaxLength="50" Width="148px" TextMode="Password" runat="server" Text='<%# Bind("Password") %>'/>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtPassword" ID="vldReqPassword" runat="server" Display="Dynamic" ErrorMessage="Password is required" Text="*"/>
                        <ajaxToolkit:PasswordStrength TextCssClass="smallfont" TargetControlID="txtPassword" ID="PasswordStrength1" runat="server" 
                            PrefixText="" MinimumNumericCharacters="1" MinimumUpperCaseCharacters="1" 
                            PreferredPasswordLength="6" RequiresUpperAndLowerCaseCharacters="True" 
                            StrengthIndicatorType="Text" />
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="txtPassword" MaxLength="50" Width="148px" TextMode="Password" runat="server" Text='<%# Bind("Password") %>'/>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtPassword" ID="vldReqPassword" runat="server" Display="Dynamic" ErrorMessage="Password is required" Text="*"/>
                        <ajaxToolkit:PasswordStrength TextCssClass="smallfont"  TargetControlID="txtPassword" ID="PasswordStrength1" runat="server" 
                            PrefixText="" MinimumNumericCharacters="1" MinimumUpperCaseCharacters="1" 
                            PreferredPasswordLength="6" RequiresUpperAndLowerCaseCharacters="True" 
                            StrengthIndicatorType="Text" />
                    </InsertItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Confirm Password">
                    <InsertItemTemplate>
                        <asp:TextBox TextMode="Password" MaxLength="50" Width="148px" ID="txtPassword1" runat="server"  />
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtPassword1" ID="vldReqPassword1" runat="server" Display="Dynamic" ErrorMessage="Confirm Password" Text="*"/>
                        <asp:CompareValidator ValidationGroup="CustomerInfo" ControlToValidate="txtPassword1" Operator="Equal" ControlToCompare="txtPassword" Display="Dynamic" ID="vldCompPassword" runat="server" ErrorMessage="Passwords do not match" Text="*"/>
                        <ajaxToolkit:PasswordStrength TextCssClass="smallfont" TargetControlID="txtPassword1" ID="PasswordStrength2" runat="server" 
                            PrefixText="" MinimumNumericCharacters="1" MinimumUpperCaseCharacters="1" 
                            PreferredPasswordLength="6" RequiresUpperAndLowerCaseCharacters="True" 
                            StrengthIndicatorType="Text" />
                    </InsertItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox TextMode="Password" MaxLength="50" Width="148px" ID="txtPassword1" runat="server" />
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtPassword1" ID="vldReqPassword1" runat="server" Display="Dynamic" ErrorMessage="Confirm Password" Text="*"/>
                        <asp:CompareValidator ValidationGroup="CustomerInfo" ControlToValidate="txtPassword1" Operator="Equal" ControlToCompare="txtPassword" ID="vldCompPassword" runat="server" ErrorMessage="Passwords do not match"/>
                        <ajaxToolkit:PasswordStrength TextCssClass="smallfont" TargetControlID="txtPassword1" ID="PasswordStrength2" runat="server" 
                            PrefixText="" MinimumNumericCharacters="1" MinimumUpperCaseCharacters="1" 
                            PreferredPasswordLength="6" RequiresUpperAndLowerCaseCharacters="True" 
                            StrengthIndicatorType="Text" />
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Security Question #1" SortExpression="SecurityQuestion1">
                    <EditItemTemplate>
                        <asp:DropDownList Width="150px" ID="ddlSecurityQ1" SelectedValue='<%# Bind("SecurityQuestion1") %>' runat="server">
                            <asp:ListItem Value="[-- Select --]" />
                            <asp:ListItem Value="Where were you born?" />
                            <asp:ListItem Value="What was your first car?" />
                            <asp:ListItem Value="What is High School name?" />
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator InitialValue="[-- Select --]" ValidationGroup="CustomerInfo" ControlToValidate="ddlSecurityQ1" ID="vldReqSecurityQ1" runat="server" Display="Dynamic" ErrorMessage="Select Security Question 1" Text="*"/>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:DropDownList Width="150px" ID="ddlSecurityQ1" SelectedValue='<%# Bind("SecurityQuestion1") %>' runat="server">
                            <asp:ListItem Value="[-- Select --]" />
                            <asp:ListItem Value="Where were you born?" />
                            <asp:ListItem Value="What was your first car?" />
                            <asp:ListItem Value="What is High School name?" />
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator InitialValue="[-- Select --]" ValidationGroup="CustomerInfo" ControlToValidate="ddlSecurityQ1" ID="vldReqSecurityQ1" runat="server" Display="Dynamic" ErrorMessage="Select Security Question 1" Text="*"/>
                    </InsertItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Security Answer #1" SortExpression="SecurityAnswer1">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtSecurityA1" MaxLength="50" runat="server" Text='<%# Bind("SecurityAnswer1") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtSecurityA1" ID="vldReqSecurityA1" runat="server" Display="Dynamic" ErrorMessage="Answer Security Question 1" Text="*"/>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="txtSecurityA1" MaxLength="50" runat="server" Text='<%# Bind("SecurityAnswer1") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtSecurityA1" ID="vldReqSecurityA1" runat="server" Display="Dynamic" ErrorMessage="Answer Security Question 1" Text="*"/>
                    </InsertItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Security Question #2" SortExpression="SecurityQuestion2">
                    <EditItemTemplate>
                        <asp:DropDownList Width="150px" ID="ddlSecurityQ2" SelectedValue='<%# Bind("SecurityQuestion2") %>' runat="server">
                            <asp:ListItem Value="[-- Select --]" />
                            <asp:ListItem Value="What is favorite color?" />
                            <asp:ListItem Value="What is mothers maiden name?" />
                            <asp:ListItem Value="What street did you grow up on?" />
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator InitialValue="[-- Select --]" ValidationGroup="CustomerInfo" ControlToValidate="ddlSecurityQ2" ID="vldReqSecurityQ2" runat="server" Display="Dynamic" ErrorMessage="Select Security Question 2" Text="*"/>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:DropDownList Width="150px" ID="ddlSecurityQ2" SelectedValue='<%# Bind("SecurityQuestion2") %>' runat="server">
                            <asp:ListItem Value="[-- Select --]" />
                            <asp:ListItem Value="What is favorite color?" />
                            <asp:ListItem Value="What is mothers maiden name?" />
                            <asp:ListItem Value="What street did you grow up on?" />
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator InitialValue="[-- Select --]" ValidationGroup="CustomerInfo" ControlToValidate="ddlSecurityQ2" ID="vldReqSecurityQ2" runat="server" Display="Dynamic" ErrorMessage="Select Security Question 2" Text="*"/>
                    </InsertItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Security Answer #2" 
                    SortExpression="SecurityAnswer2">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtSecurityA2" MaxLength="50" runat="server" Text='<%# Bind("SecurityAnswer2") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtSecurityA2" ID="vldReqSecurityA2" runat="server" Display="Dynamic" ErrorMessage="Answer Security Question 2" Text="*"/>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="txtSecurityA2" MaxLength="50" runat="server" Text='<%# Bind("SecurityAnswer2") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ValidationGroup="CustomerInfo" ControlToValidate="txtSecurityA2" ID="vldReqSecurityA2" runat="server" Display="Dynamic" ErrorMessage="Answer Security Question 2" Text="*"/>
                    </InsertItemTemplate>
                </asp:TemplateField>
            </Fields>
        <RowStyle CssClass="tdleft"></RowStyle>
        </asp:DetailsView>
        <br />
        <asp:Button ValidationGroup="CustomerInfo" ID="btnSave" runat="server" Text="Update" />
        </div>
    </div>
    <br />
</ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="dvCustomerData" EventName="ItemCommand" />
        <asp:AsyncPostBackTrigger ControlID="dvUserData" EventName="ItemCommand" />
    </Triggers>
</asp:UpdatePanel>



